home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / setUpIKSelectionScriptJob.me < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.6 KB  |  83 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Feb 13, 2001
  22. //  Author:         cdt
  23. //
  24. //  Description:
  25. //      A scriptJob to contro the IK/FK switching UI
  26. //
  27.  
  28.  
  29. global proc ikSelectionChanged(string $menu)
  30. //
  31. //    Description:
  32. //        When the selection changes, this updated the ik/fk UI
  33. //
  34. {
  35.     if (`headsUpDisplay -exists HUDIKSolverState` &&
  36.         `headsUpDisplay -q -vis HUDIKSolverState`) {
  37.  
  38.         //    The menu will get updated when the Heads Up Display is 
  39.         //    updated.
  40.         //
  41.         return;
  42.     }
  43.  
  44.     //    There are five different returned values from ikFKSolverState()
  45.     //        0    :    No joints or ikHandles are selected.
  46.     //        1    :    The selected items have their solver enabled.
  47.     //        2     :    The selected items have their solver disabled.
  48.     //        3     :    No solver on the selcted joints.
  49.     //        4     :    Some of the selected items have their solvers 
  50.     //                enabled and others have their solvers disabled.
  51.     //
  52.     int $solverState = ikFKSolverState(`ls -sl`);
  53.     int $ikOn = false;
  54.  
  55.     if ($solverState == 1 || $solverState == 4) {
  56.         $ikOn = true;
  57.     }
  58.  
  59.     menuItem -edit -checkBox $ikOn $menu;
  60.     optionVar -intValue ikFKSwitchState $ikOn;
  61. }
  62.  
  63. global proc updateIKFKCheckBox(int $state)
  64. {
  65.     global string $gikFKSwitchStateCheckBoxMenu;
  66.     if (`menuItem -ex $gikFKSwitchStateCheckBoxMenu`) {
  67.         menuItem -edit -checkBox $state $gikFKSwitchStateCheckBoxMenu;
  68.         optionVar -intValue ikFKSwitchState $state;
  69.     }
  70. }
  71.  
  72. global proc setUpIKSelectionScriptJob(string $menu)
  73. {
  74.     global string $gikFKSwitchStateCheckBoxMenu;
  75.     $gikFKSwitchStateCheckBoxMenu = $menu;
  76.  
  77.     scriptJob -protected -event "SelectionChanged" 
  78.         ("ikSelectionChanged(\""+$menu+"\")");
  79.  
  80.     scriptJob -protected -event timeChanged
  81.         ("ikSelectionChanged(\""+$menu+"\")");
  82. }
  83.